package com.kylin.system;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 系统模块
 * 
 * @author wuhao
 */
@SpringBootApplication
public class SystemApplication
{
    private static Logger log = LoggerFactory.getLogger(SystemApplication.class);
    public static void main(String[] args) throws UnknownHostException
    {
        ConfigurableApplicationContext application = SpringApplication.run(SystemApplication.class, args);
        Environment env = application.getEnvironment();
        log.info("\n" +
                "*****************系统模块启动成功******************\n" +
                "  .----..-. .-..----..----..----. .----. .----. \n" +
                " { {__-`| } { || }`-'| }`-'} |__}{ {__-`{ {__-` \n" +
                " .-._} }\\ `-' /| },-.| },-.} '__}.-._} }.-._} }\n" +
                " `----'  `---' `----'`----'`----'`----' `----'  \n" +
                "************************************************\n" +
                "Application '{}' is running!\n" +
                "Access URLs: http://{}:{}",
                env.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port")
        );
    }
}
